function GetPoints(_troop){ // _startLat, _startLong, _endLat, _endLong){
	
	var _points = [];
	var _startLat = _troop.currentLatitude;
	var _startLong = _troop.currentLongitude;
	var _endLat = _troop.newLatitude;
	var _endLong = _troop.newLongitude;
	
	
	// The bellow URL is used to Get the route of current location to assigned  destination  Location.
	//URL para obtener los datos de la Ruta utilizando la API de Google 
 	var url = 'http://maps.googleapis.com/maps/api/directions/json?' + 
 		'origin=' + _startLat + ',' + _startLong + 
  	  	'&destination=' + _endLat + ',' + _endLong + 
 		'&sensor=true';
 	
 	//alert(url);
 		
	// The Bellow URL use the static current location to destination  Location. 
	//var url = "http://maps.googleapis.com/maps/api/directions/json?origin=37.422502,-122.0855498&destination=37.389569,-122.050212&sensor=true";
 	 	
 	var xhr = Titanium.Network.createHTTPClient();
	xhr.open('GET', url, false);
	 
	xhr.onload = function() {
    	Ti.App.fireEvent('geo.GetPoints', {'responseText': this.responseText});
    };
  	  		
	Ti.App.addEventListener('geo.GetPoints', function(data) {
    	try{
    		_troop.routePoints = [];
    		
    		// Bellow Variable have the step of the current location to destination  Location. Using the Steps we going to create a route.
       		var position = JSON.parse(data.responseText).routes[0].legs[0].steps;
 			    
	 		if (position[0] != null) {
	 			
 				_troop.routePoints[_troop.routePoints.length] = {
 					latitude: position[0].start_location.lat,
 			        longitude: position[0].start_location.lng
 			        };
 
				// Here we use the for loop to collect all the steps and push it to the array and use this array to form the route in android.
 	      		for (var i = 0; i < position.length; i++) {
 		   			_troop.routePoints[_troop.routePoints.length] = {
 						latitude : position[i].end_location.lat, 
 		    			longitude : position[i].end_location.lng
 		    		};
    			}
    			
    			
 				_troop.route = {
    					name : 'Route' + _troop.id,
        				points : _troop.routePoints,
        				color : "red",
        				width : 5
    			};
 			
    			alert('geo.GetPoints: ' + _troop.routePoints.length);
    			    			
    		} 
    		else {
        		alert('GEO - Google no encontro una ruta');
    		}
    	}
 		catch(e){
 			alert('GEO - Error al calcular la ruta ' + e.message);
 		}
 	});	
 	
 	
 	// Send the request to server
 	xhr.send();
 	
 	
 	/*
 	if(xhr.status == 200){
 		try{
    		_points = [];
    		
    		alert('xhr.responseText: ' + xhr.responseText);
    		
    		// Bellow Variable have the step of the current location to destination  Location. Using the Steps we going to create a route.
       		var position = JSON.parse(xhr.responseText).routes[0].legs[0].steps;
 			    
	 		if (position[0] != null) {
	 			
 				_points[_points.length] = {
 					latitude: position[0].start_location.lat,
 			        longitude: position[0].start_location.lng
 			        };
 
				// Here we use the for loop to collect all the steps and push it to the array and use this array to form the route in android.
 	      		for (var i = 0; i < position.length; i++) {
 		   			_points[_points.length] = {
 						latitude : position[i].end_location.lat, 
 		    			longitude : position[i].end_location.lng
 		    		};
    			}
    			
 				//alert('geo.GetPoints: ' + _troop.routePoints.length);
    			    			
    		} 
    		else {
        		alert('GEO - Google no encontro una ruta');
    		}
    	}
 		catch(e){
 			alert('GEO - Error al calcular la ruta ' + e.message);
 		}
 	}
 	else {
 		alert('xhr.status: ' + xhr.status);
 		
 		alert('xhr.responseText: ' + xhr.responseText);
 		
 	}
 	
 	return _points;*/
};

exports.GetPoints = GetPoints;
